<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<h:outputStylesheet library="css" name="style.css" />
</h:head>
<h:body>
	<center>
		<h1>Search Engine</h1>
	</center>
	<h:form>
		<p:panel id="panel" style="border-width:0;">
			<center>
				<p:inputText id="search" required="true" label="search"
					value="#{search.value}">
					<f:validateLength minimum="2" />
				</p:inputText>

				<p:commandButton value="Submit" update="outputPanel"
					actionListener="#{search.search}" />


			</center>
			<p:messages />

		</p:panel>
		<p:outputPanel id="outputPanel" style="border-width:0;">
			<p:panel id="displaypanel" rendered="#{search.show}"
				style="border-width:0;">
				<h:form id="form">

					<p:dataGrid var="result" value="#{search.results}" columns="1"
						rows="10" paginator="true"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="10,20,30">

						<p:panel header="#{result.docNo}: #{result.docTitle}"
							style="text-align:left">
							<h:panelGrid columns="1" style="width:100%">

								<h:outputText value="#{result.summary}" />

							</h:panelGrid>
						</p:panel>
					</p:dataGrid>
				</h:form>

			</p:panel>
		</p:outputPanel>



	</h:form>
</h:body>
</html>